package edu.mapi.aamas.operator;

import java.awt.Color;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;

import edu.mapi.aamas.common.MessagePanel;
import edu.mapi.aamas.gui.tablelayout.TableLayout;

/**
 * @author ZP
 */
public class OperatorInterface extends JPanel {

	private Renderer2DPanel r2d;
	private SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss,SSS");	
	//private JTextPane textPane = new JTextPane();
	private MessagePanel messagePanel = new MessagePanel();
	
	public OperatorInterface(OperatorAgent agent) {
		setLayout(new TableLayout(new double[] {TableLayout.FILL}, new double[] {TableLayout.FILL, 200}));
		r2d = new Renderer2DPanel(agent);
		add(r2d, "0,0");
		//messagePanel.setEditable(false);
		add(messagePanel, "0,1");
	}
	
	private String getTimeStamp() {
		return dateFormat.format(new Date(System.currentTimeMillis()));
	}
	
	/**
	 * Appends the given message to the textPane (plain style)
	 * @param text The message to be appended
	 */
	public void appendMessage(String message, Color type) {
		messagePanel.writeMessageTextln(message, type);
	}

	public Renderer2DPanel getR2d() {
		return r2d;
	}
}
